package com.kb.erp.controller;


import com.kb.erp.entity.file.LocationFile;
import com.kb.erp.entity.file.ResultVO;
import com.kb.erp.service.FileHandleService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@RequestMapping("/common")
public class FileHandController {

    @Resource
    private FileHandleService fileHandleService;


    //解析
    @PostMapping("/upload")
    public ResultVO queryResignInfo(@RequestParam(value="bom",required = false) MultipartFile bom, @RequestParam(value="location",required = false) MultipartFile location,
                                    @RequestParam(value="locationNumber") String locationNumber, @RequestParam(value="meterialCode") String meterialCode,
                                    @RequestParam(value="specificationDescription") String specificationDescription, @RequestParam(value="model") String model,
                                    @RequestParam(value="encapsulation") String encapsulation, @RequestParam(value="number") String number,
                                    @RequestParam(value="RefDes") String RefDes, @RequestParam(value="PartDecal") String PartDecal,
                                    @RequestParam(value="Layer") String Layer, @RequestParam(value="Orient") String Orient,
                                    @RequestParam(value="X") String X, @RequestParam(value="Y") String Y, @RequestParam(value="encapsulation") String encapsulationValue
    ) throws Exception {
        return  fileHandleService.upload(bom,location,locationNumber,meterialCode,specificationDescription,model,number
        ,RefDes,PartDecal,Layer,Orient,X,Y,encapsulationValue);
    }


    //上传文件获取表头
    @PostMapping("/PreUpload")
    public ResultVO PreUpload(@RequestParam(value="bom",required = false) MultipartFile bom, @RequestParam(value="location",required = false) MultipartFile location) throws Exception {

        return  fileHandleService.PreUpload(bom,location);
    }

}
